/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundless.entities;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author hendrikdekock
 */
@Entity
@Table(name = "INVITEBYEMAIL")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Invitebyemail.findAll", query = "SELECT i FROM Invitebyemail i"),
    @NamedQuery(name = "Invitebyemail.findBySenderid", query = "SELECT i FROM Invitebyemail i WHERE i.invitebyemailPK.senderid = :senderid"),
    @NamedQuery(name = "Invitebyemail.findByLeague", query = "SELECT i FROM Invitebyemail i WHERE i.invitebyemailPK.league = :league")})
public class Invitebyemail implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected InvitebyemailPK invitebyemailPK;
    @JoinColumn(name = "LEAGUE", referencedColumnName = "ID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private League league1;
    @JoinColumn(name = "SENDERID", referencedColumnName = "ID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Account account;

    public Invitebyemail() {
    }

    public Invitebyemail(InvitebyemailPK invitebyemailPK) {
        this.invitebyemailPK = invitebyemailPK;
    }

    public Invitebyemail(int senderid, byte[] inviteemail, int league) {
        this.invitebyemailPK = new InvitebyemailPK(senderid, inviteemail, league);
    }

    public InvitebyemailPK getInvitebyemailPK() {
        return invitebyemailPK;
    }

    public void setInvitebyemailPK(InvitebyemailPK invitebyemailPK) {
        this.invitebyemailPK = invitebyemailPK;
    }

    public League getLeague1() {
        return league1;
    }

    public void setLeague1(League league1) {
        this.league1 = league1;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (invitebyemailPK != null ? invitebyemailPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Invitebyemail)) {
            return false;
        }
        Invitebyemail other = (Invitebyemail) object;
        if ((this.invitebyemailPK == null && other.invitebyemailPK != null) || (this.invitebyemailPK != null && !this.invitebyemailPK.equals(other.invitebyemailPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "boundless.entities.Invitebyemail[ invitebyemailPK=" + invitebyemailPK + " ]";
    }
    
}
